package com.prime.tutorial.moviestore.view.reports;

import com.prime.tutorial.moviestore.domain.Location;
import com.prime.tutorial.moviestore.service.reports.ReportsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.util.List;
/**
 * Provides the view level of the addressesWithFreePorts report.
 * @author vasylja
 */
@Component("addressesWithFreePorts")
@Scope("request")
public class AddressesWithFreePortsImpl {
    private ReportsService reportsService;
    private List<Location> listAddressesWithFreePorts;

    @Autowired
    public AddressesWithFreePortsImpl(ReportsService reportsService) {
        this.reportsService = reportsService;
        setListAddressesWithFreePorts(this.reportsService.getAddressesWithFreePortsReport());
    }

    public List<Location> getListAddressesWithFreePorts() {
        return listAddressesWithFreePorts;
    }

    private void setListAddressesWithFreePorts(List<Location> listAddressesWithFreePorts) {
        this.listAddressesWithFreePorts = listAddressesWithFreePorts;
    }
}
